<template>
	<view class="find-pass">
		<view class="res-con">
			<view class="tips">
				如果你忘记了密码，可在此重置新密码。
			</view>
			<form @submit="formSubmit"   @reset="formReset">
				<view class="username ipt">
					<input type="text" name="username" placeholder="用户名" />
				</view>
				<view class="username ipt">
					<input type="text" name="tel" placeholder="手机号" />
				</view>
				<view class="password ipt">
					<input type="password" name="password" placeholder="登录密码" />
				</view>
				<view class="num ipt">
					<input type="text" name="username" placeholder="验证码" />
					<view class="code" @tap="changeCodeFlag">
						<text v-if="!codeFlag">获取验证码</text>
						<text v-else>{{sec}}s</text>
					</view>
				</view>
				<view class="btns">
					<button form-type="submit" class="btn">重置密码</button>
				</view>
			</form>
			</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				codeFlag: false,
			};
		},
		methods: {
			agree () {
				this.agreementFlag = !this.agreementFlag;
			},
			changeCodeFlag () {
				this.codeFlag  = true;
				if (this.codeFlag) {
				let timer = setInterval(() => {
						// console.log('1')
						this.sec--;
						if (this.sec == 0) {
							clearInterval(timer);
						}
					}, 1000)
				}
			}
		}
	}
</script>

<style lang="scss">
.find-pass {
	width: 100%;
	height: calc(100vh - 44px);
	background-color: #f1ece7;
	.res-con {
		width: 100%;
		box-sizing: border-box;
		padding: 0 80rpx;
		.tips {
			padding: 50rpx 0 30rpx  0;
			font-size: 28rpx;
			padding-left: 50rpx;
			color: #9F9F9F;
			letter-spacing: 1.71rpx;
		}
		.num {
			position: relative;
			.code {
				position: absolute;
				top: 35rpx;
				right: 30rpx;
				font-size: 26rpx;
				box-sizing: border-box;
				padding-left: 50rpx;
				color: #9F9F9F;
			}
		}
		.ipt{
			width: 100%;
			height: 100rpx;
			border-radius: 80rpx;
			box-shadow: 0 0 30rpx 0 rgba(43,86,112,.1);
			margin-bottom: 36rpx;
			input {
				width: 100%;
				height: 100%;
				font-size: 28rpx;
				box-sizing: border-box;
				padding-left: 50rpx;
				color: #9F9F9F;
				letter-spacing: 1.71rpx;
			}
		}
		.btns {
			margin: 68rpx 0 22rpx 0;
			.btn {
				background: #354E44;
				font-size: 30rpx;
				height: 94rpx;
				border-radius: 80rpx;
				color: #FFFFFF;
				letter-spacing: 2.14rpx;
				display: flex;
				align-items: center;
				justify-content: center;
				font-weight: bolder;
			}
		}
		}
}
</style>
